import urllib.request
import socket


try:
    
    url = "http://imgsrc.baidu.com/forum/w%3D580/sign=6063e964163853438ccf8729a313b01f/95b1cb1349540923881d79769458d109b3de4945.jpg"   
    socket.setdefaulttimeout(0.01)
    
    urllib.request.urlretrieve(url,"1.jpg")
    
except Exception as e:

    print ('错误信息:',e)
    print ('重新下载..')
    socket.setdefaulttimeout(0.1)
    urllib.request.urlretrieve(url,"1.jpg")
    
    
